package service

import (
	"idle/internal/game/mgr"
	"idle/pkg/config"
)

func HeroLvUp(heroId int) {
	hero := mgr.GetHeroMgr().GetHeroById(heroId)

	expConfig := config.GetHeroLvUpExpConfig(hero.Lv)
	if expConfig == nil {
		return
	}

	needExp := expConfig.Exp
	if hero.Exp >= needExp {
		hero.Lv += 1
		hero.Exp -= needExp
	}

}
